# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=yelp
pkgver=42.2
pkgrel=2
pkgdesc="Get help with GNOME"
url="https://wiki.gnome.org/Apps/Yelp"
license=(GPL)
arch=(x86_64)
depends=(
  bzip2
  libhandy
  libxslt
  webkit2gtk-4.1
  xz
  yelp-xsl
)
makedepends=(
  appstream-glib
  autoconf-archive
  git
  itstool
)
optdepends=('man-db: View manual pages')
provides=(libyelp.so)
groups=(gnome)
_commit=9fd1a84e1eae23db21939ff76c7e96d5422d3b1a  # tags/42.2^0
source=(
  "git+https://gitlab.gnome.org/GNOME/yelp.git#commit=$_commit"
  no-gtk-doc.diff
)
b2sums=('SKIP'
        'd6200723395292742105065baeab12ae308f8141069343c5ec79bcab10e4efbdea69ea9deffdcd7a2fb0c0ceeb886398b8b303ff750af1a79c38c64046664501')

pkgver() {
  cd yelp
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd yelp

  # Remove vestiges of docs build to allow building without gtk-doc
  git apply -3 ../no-gtk-doc.diff

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  local configure_options=(
    --prefix=/usr
    --sysconfdir=/etc
    --localstatedir=/var
    --enable-compile-warnings=minimum
    --disable-static
  )

  cd yelp
  ./configure "${configure_options[@]}"
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd yelp
  make DESTDIR="$pkgdir" install
}

# vim:set sw=2 sts=-1 et:
